package com.literature.search.user.controller;

import cn.dev33.satoken.annotation.SaCheckRole;
import com.literature.search.core.entity.R.AjaxJson;
import com.literature.search.core.entity.Role;
import com.literature.search.user.service.IUserAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: DangKong
 * @Date: 2023/3/2 13:10
 * @Description:
 */

@Api(tags = "用户权限")
@RestController
@RequestMapping("/user/auth/")
public class UserAuthController {

    @Autowired
    private IUserAuthService userAuthService;

    @ApiOperation(value = "创建role", notes = "创建一个新的角色，一般不用，除非在新的地方部署而没有数据库")
    @SaCheckRole("admin")
    @PostMapping("addRole")
    public AjaxJson addRole(@RequestBody Role role) {
        return userAuthService.addRole(role);
    }

}
